package com.km.team.phsystem.beans.pojo;

import java.io.Serializable;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class DatePhConfig implements Serializable {
    private Integer id;

    private Date date;

    private Integer systemBusitypeId;

    private Integer acceptNo;

    private Integer doAcceptNo;

    private static final long serialVersionUID = 1L;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDate() {
        Instant instant = date.toInstant();
        ZoneId zone = ZoneId.systemDefault();
        LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);
        return localDateTime.toLocalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Integer getSystemBusitypeId() {
        return systemBusitypeId;
    }

    public void setSystemBusitypeId(Integer systemBusitypeId) {
        this.systemBusitypeId = systemBusitypeId;
    }

    public Integer getAcceptNo() {
        return acceptNo;
    }

    public void setAcceptNo(Integer acceptNo) {
        this.acceptNo = acceptNo;
    }

    public Integer getDoAcceptNo() {
        return doAcceptNo;
    }

    public void setDoAcceptNo(Integer doAcceptNo) {
        this.doAcceptNo = doAcceptNo;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        DatePhConfig other = (DatePhConfig) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getDate() == null ? other.getDate() == null : this.getDate().equals(other.getDate()))
            && (this.getSystemBusitypeId() == null ? other.getSystemBusitypeId() == null : this.getSystemBusitypeId().equals(other.getSystemBusitypeId()))
            && (this.getAcceptNo() == null ? other.getAcceptNo() == null : this.getAcceptNo().equals(other.getAcceptNo()))
            && (this.getDoAcceptNo() == null ? other.getDoAcceptNo() == null : this.getDoAcceptNo().equals(other.getDoAcceptNo()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getDate() == null) ? 0 : getDate().hashCode());
        result = prime * result + ((getSystemBusitypeId() == null) ? 0 : getSystemBusitypeId().hashCode());
        result = prime * result + ((getAcceptNo() == null) ? 0 : getAcceptNo().hashCode());
        result = prime * result + ((getDoAcceptNo() == null) ? 0 : getDoAcceptNo().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", date=").append(date);
        sb.append(", systemBusitypeId=").append(systemBusitypeId);
        sb.append(", acceptNo=").append(acceptNo);
        sb.append(", doAcceptNo=").append(doAcceptNo);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}